var SupplementLog = {
    id: "SupplementLogTable",
    seItem: null,
    table: null,
    layerIndex: -1
};
SupplementLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: '补单人', field: 'singlePerson', align: 'center', valign: 'middle', sortable: true},
        {title: '患者电话', field: 'customerPhone', align: 'center', valign: 'middle', sortable: true},
        {title: '患者姓名', field: 'customerName', align: 'center', valign: 'middle', sortable: true},
        {
            title: '补单时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true,
            formatter: function (value, row, index) {
                return value.substring(0, 19);
            }
        },
        {title: '详情', field: 'classname', align: 'center', valign: 'middle', sortable: true},
        {title: '是否成功', field: 'succeed', align: 'center', valign: 'middle', sortable: true},
    ];
};
SupplementLog.formParams = function () {
    var queryData = {};
    queryData['singlePerson'] = $("#singlePerson").val();
    queryData['customerPhone'] = $("#customerPhone").val();
    queryData['customerName'] = $("#customerName").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}
SupplementLog.resetSearch = function () {
    $("#singlePerson").val("");
    $("#customerPhone").val("");
    $("#customerName").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    SupplementLog.search();
};
SupplementLog.search = function () {
    SupplementLog.table.refresh({query: SupplementLog.formParams()});
};
$(function () {
    var defaultColunms = SupplementLog.initColumn();
    var table = new BSTable(SupplementLog.id, "/supplementLog/list", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(SupplementLog.formParams());
    SupplementLog.table = table.init();
    SupplementLog.table = table;

    $("#zoom").click(function () {
        if ($("#zoom > span").hasClass('tabMark')) {
            $("#zoom > span").removeClass('tabMark').html('条件展开');
            $("#zoom > img,.divFlex").toggle();
            $(document).ready(function () {
                $('#SupplementLogTable').bootstrapTable('resetView', {height: $(window).height() - 76});
            });
        } else {
            $("#zoom > span").addClass('tabMark').html('条件收起');
            $("#zoom > img,.divFlex").toggle();
            $(document).ready(function () {
                $('#SupplementLogTable').bootstrapTable('resetView', {height: $(window).height() - 137});
            });
        }
    });
});